import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios'
import {getAddSubmit} from './actions/index.js'
Vue.use(Vuex)
axios.defaults.baseURL = 'https://dbyxs.xyz:8002'
//Vue.prototype.$http = axios
export default new Vuex.Store({
  state: {
    count:{},
    userid:''
  },
  mutations: {
    getstate(state,name){
      state.count=name
    },
    getstateuserid(state,name){
      state.userid=name
    }
  },
  actions: {
    getlist(context,name){
      context.commit('getstate',name)
    },
    getuserid(context){
      var token=sessionStorage.getItem('token')
      var data={
        token
      }
     // console.log(data,axios)
      axios.post('/user/token',data).then(res=>{
        console.log(res)
      })
    },
    ...getAddSubmit
  },
  modules: {
  }
})
